#include <gtk/gtk.h>
#include "gtk/gtkPrincipal.h"
#include "gtk/gtkMenu.h"
#include "db/database.h"

static gboolean on_quit(GtkWidget *widget,
		    GdkEvent  *event,
		    gpointer   data)
{
  gtk_widget_destroy(widget);
  return TRUE;
  (void)widget;
  (void)event;
  (void)data;
}

int main(int argc, char **argv)
{
  GtkWidget *window;
  GtkPrincipal *principal;
  GtkWidget *vbox;
  GtkWidget *menu;
  ouvrir_Db();
  gtk_init(&argc, &argv);
  
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size(GTK_WINDOW(window), 700, 600);
  vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
  gtk_container_add(GTK_CONTAINER(window), vbox);
  principal = creer_GPri();
  
  menu = creer_GMen(principal);
  gtk_box_pack_start (GTK_BOX (vbox), menu, FALSE, FALSE, 0);
  
  gtk_box_pack_start (GTK_BOX (vbox), getContainer_GPri(principal), TRUE, TRUE, 1);

  gtk_container_set_border_width (GTK_CONTAINER (window), 0);

  g_signal_connect(window, "destroy", G_CALLBACK (on_quit), NULL);
  /* Here we connect the "destroy" event to the gtk_main_quit() function.
   *
   * This signal is emitted when we call gtk_widget_destroy() on the window,
   * or if we return FALSE in the "delete_event" callback.
   */
  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);

  gtk_widget_show_all(window);

  gtk_main();
  fermer_Db();

  return 0;
  (void)argc;
  (void)argv;
}
